package edu.java.homework.hw10.tests;

//5.19
public class MyClass3 {
    static void f() throws InterruptedException {
	throw new InterruptedException("Time for lunch");
    }

    public static void main(String[] args) {
	try {
	    f();
	} catch (InterruptedException e) {
	    System.out.println(1);
	    throw new RuntimeException();
	} catch (RuntimeException e) {
	    System.out.println(2);
	    return;
	} finally {
	    System.out.println(4);
	}
	System.out.println(5);
    }
}

/*
 * Êàêâî ùå ñå îòïå÷àòà ïðè èçïúëíåíèå íà ïðîãðàìàòà
 */

// Result 1, 4
// The InterruptedException which is thrown if f()-method is cathced in the
// catch-statement of the main. We print 1 and after that throw
// RuntimeException.
// Therefore the finally-block executes and the program will stop executing. The
// statements after finally-block will not be executed.